package com.pxxy.springboot;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

/*******************
 * 如果要有war 包方式部署，则需要做如下步骤：
 * 1. 在pom.xml中，把 packaging改为 war, 如：<packaging>war</packaging>
 * 2. 让启动类继承： SpringBootServletInitializer, 并重写 configure 方法, 在 configure方法中，通过参数 builder
 * 来调用 sources方法，并传入：XXXApplication.class 为参数即可
 */
@SpringBootApplication
//启动 Servlet相关的组件，如：Filter
@ServletComponentScan
//public class SpringbootTutorialApplication extends SpringBootServletInitializer {
public class SpringbootTutorialApplication extends SpringBootServletInitializer {
    public static void main(String[] args) {
        SpringApplication.run(SpringbootTutorialApplication.class, args);
    }

    /**
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(SpringbootTutorialApplication.class);
        //return super.configure(builder);
    }
    */
}
